package fitness

import (
	"gorm.io/gorm"
	"organoid_public/domain/fitness/model"
	"organoid_public/domain/fitness/respository"
	"organoid_public/infrastructure/db"
)

type OpenAppRepository struct {
	db *gorm.DB
}

func NewOpenAppRepository(db db.DefaultDb) respository.OpenAppRepoInterface {
	return &OpenAppRepository{
		db: db,
	}
}

func (o *OpenAppRepository) GetAppInfo(appid string) (*model.OpenApp, error) {
	var OpenApp model.OpenApp
	err := o.db.Model(&model.OpenApp{}).Where("open_app_id =?", appid).Find(&OpenApp).Error
	return &OpenApp, err
}
